﻿using FluentNHibernate.Mapping;
using AdventureWorks.Domain;
namespace AdventureWorks.DataAccess.Mappings
{
    public class PhoneContactMapping : ClassMap<PhoneContact>
    {
        public PhoneContactMapping()
        {
            Schema("Person");
            Table("PersonPhone");
            CompositeId()
                .KeyProperty(x => x.PhoneNumber)
                .KeyReference(x => x.Person, "BusinessEntityId")
                .KeyProperty(x => x.PhoneType, c => c.ColumnName("PhoneNumberTypeId").Type(typeof(PhoneContactType)));
                
            //Map(x => x.PhoneType, "PhoneNumberTypeId").CustomType<PhoneContactType>();
        }
    }
}
